package demo3.boot.controller;

import demo3.boot.service.AsyncService;
import demo3.boot.service.ScheduledService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.mail.MessagingException;

@RestController
public class AsyncController {
    @Autowired
    AsyncService asyncService;
//    周期性执行
    @Autowired
    ScheduledService scheduledService;

    @RequestMapping("/delay")
    public String hello() throws MessagingException {
        asyncService.delay();
//        scheduledService.sendMail();
        return "Success";
    }
}
